package Song.Han.day04.demo04;
/*
* 题目：
*   定义一个数组，用来存储3个Person对象
*
* 数组缺点：一旦创建，长度不可变！
* */
public class Demo01Array {

    public static void main(String[] args) {

        Person[] array = new Person[3];

        Person one = new Person("张三",18);
        Person two = new Person("李四",20);
        Person three = new Person("王五",48);

        //将one的地址值赋值到0号元素位置
        array[0] = one;
        array[1] = two;
        array[2] = three;

        System.out.println(array[0]);
        System.out.println(array[1]);
        System.out.println(array[2]);

        Person person = array[1];
        System.out.println(person.getName());
    }
}
